AMI: Pin down uid/gid values when creating users/groups - #2412
Conversation
PostgreSQL Extension Dependency Analysis: PR #2412
SummaryNo extensions had dependencies with MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Extension DependenciesPostgreSQL 17 Extension DependenciesOrioleDB 17 Extension Dependencies |
PostgreSQL Package Dependency Analysis: PR #2412
SummaryNo packages had MAJOR version updates. Full Analysis ResultsPostgreSQL 15 Dependency ChangesExtracting PostgreSQL 15 dependencies...
Runtime Closure Size
Raw Dependency ClosurePostgreSQL 17 Dependency ChangesExtracting PostgreSQL 17 dependencies...
Runtime Closure Size
Raw Dependency Closure |
|
Note that this enforces "bad" UIDs on these users. UIDs over 1000 are for human users, not for system services. System services should have an UID below 1000 (well, on debian, 500 for RH systems as far as I remember). |
5490d95 to
070e66b
Compare
Yep, not trying to fix the state of things atm just avoid more unexpected heartache.
Not worried about that right now, I expect it will fail at build time so we can address it then.
We don't have any evidence of varying [UG]IDs before bfe182b4 and this PR enforces the expectation. The script I've added can be used to fetch AMIs and verify, the lack of issues until recent rollout gives me some small confidence it won't be too bad. That and the fact that both amd64 and arm64 AMIs have matching [UG]IDs.
This is a stop-gap measure until we come up with a more correct solution, systemd managed ids or encasing in OCI (where file perms can still be an issue when crossing containers). |
070e66b to
870cefd
Compare
|
I've added a script to fetch ami root vol's contents and used it to confirm the pinned uid/gids map to same values we had in previous AMIs and .155 had the wrong ones: |
0508dd0 to
c0cac2d
Compare
Nothing uses it and its just a drag on the repo, for understanding it and grepping.
ed43526 to
e6b4d05
Compare
Ran into issue with different gids between AMIs that caused suspend/wake to fail due to permission errors. The previous goss tests were only checking for user/group existence which is a very light weight test, uid/gid are the only thing that matter not the user/group name. We now explicitly pin the uid and gid so that we avoid this issue in the future, goss verifies at ami build time. I had to move the ubuntu user from being created at stage2 boot time by cloud-init into stage1 by ansible so we could control the uid/gid.
This adds ansible-lint with a custom lint rule that ensures we explicitly set uid and gid when using the user and group modules. This way we don't end up with unknown/different values between AMI builds.
👏 x86_64 👏 is 👏 not 👏 a 👏 second 👏 class 👏 system 👏
Does what it says on the tin, finds an AMI's root volume and fetches the disk contents as a raw image for easy loopback mounting.
2736e8a to
e59bcaf
Compare
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
We create users/groups willy nilly without a worry about uid/gids assigned to them.
What is the new behavior?
We no longer do that. Any user/group created in ansible needs to provide the relevant uid/gid, this is checked by a custom ansible-lint linter. We also check the uid/gid using supascan/goss at ami build time to catch any unexpected change.
Additional context
When I dropped the nginx user/group the other uid/gids changed and caused an issue with resume from suspend due to file perms.Nothing uses it and its just a drag on the repo, for understanding it
and grepping.